2 ############################################################
3 # source: file_inc_testing.sh
4 # author: devenkong(18151155@qq.com)
6 ############################################################
7 # Copyright (C) 2022- Free Software Foundation, Inc.
8 # This configure script is free software; the Free Software
9 # Foundation gives unlimited permission to copy, distribute
11 ############################################################
13 # this is a testing script for shlib file including. it
14 # test different include paths by user setting, and test
15 # if the including shlib works.
16 ############################################################
28 ############################################################
31 #TESTING_TMP_DIR=~/.testing/$0/
34 HDRB
="${BCMAGENTA}${CHIGHL}"
37 IMPB
="${FCMAGENTA}${CHIGHL}"
38 IMPE
="${FCCYAN}${CHIGHL}"
41 # fdesc: debug string for test program hint. it outputed with color.
42 # but the "=" signature is not putted in this function. it is
43 # used to show difference in code. developer can recognize it
44 # to get the debug info clearly.
48 dbgout
"${FCCYAN}${CHIGHL}$@${CNORMAL}\n"
52 #####################################################################
54 attr_declare SRCFILE
="test.sh"
55 attr_declare AUTHOR
="test"
56 attr_declare DATE
="$(date +%Y-%m-%d)"
58 # this is a templete of file header."
60 # all string content is a variable.
61 attr_declare SHEBANG
='#!/bin/bash'
62 # variable is at the beginning of a string.
63 attr_declare TESTING
='output test string in a variable.'
64 # variable at the end of a string.
65 attr_declare SRCFILE
='strfmt.shlib'
66 # multi-var in a line. there are string between variables.
67 attr_declare AUTHOR
='devenkong'
68 attr_declare EMAIL
='devenkong@126.com'
69 # $(date +%Y-%m-%d), use static value instead for test checking.
70 # multi-var in a line. a variable followed with another directly.
71 attr_declare DATE
='2022-11-23'
73 attr_declare TIME
='@(echo 10:20:30)'
74 # a variable in the middle of a string.
75 attr_declare COPYRIGHT_DATE
='2022- '
77 attr_declare COPYING
='# Copyright (C) @{COPYRIGHT_DATE}- Free Software Foundation, Inc.
78 # This configure script is free software; the Free Software
79 # Foundation gives unlimited permission to copy, distribute
81 # test for multi-line variable.
83 # this file is a string templete library.
84 # it like the function printf in c language. it also provide
85 # reverse operation to recognize variable string by the same format
88 attr_declare INC_FILE_LIST
='.shlibinc
90 @<[libinc[libinc]]include @<[inclibname]stdio.shlib>'
92 attr_declare str_tmpl
="
93 this is a text for strfmt() testing.
95 ############################################################
96 ${TESTING} for pure testing.
98 # author: @{AUTHOR} (email:@{EMAIL})
99 # date: @{DATE}@{TIME}
100 ############################################################
102 ############################################################
104 ############################################################
106 #####################
108 #####################
115 echo -ne "=================================\n"
116 echo -ne "= include lib path testing.\n"
118 dbgoutd
"=================================\n"
119 TDBGOUT
"= if this string is displayed on screen,"
120 TDBGOUT
"= that means shlib of stdio.shlib is included by 'include' cmd."
122 dbgoutd
"SHLIB_LIST=$SHLIB_LIST\n"
123 dbgoutd
"SHLIB_INC_LIST=$SHLIB_INC_LIST\n"
125 dbgoutd
"=================================\n"
126 dbgoutd
"= ${HDRB}append shlib path manully by var assignment.${HDRE}\n"
127 dbgoutd
"=================================\n"
128 TDBGOUT
"= current shlib paths:"
130 TDBGOUT
"= create lib path dir '~/.testing/shlib1',"
131 TDBGOUT
"= and append it to SHLIB_PATH by var assignment."
133 dbgoutd
"=================================\n"
134 dbgoutd
"= 1.${HDRB}strfmt() testing.${HDRE}\n"
135 dbgoutd
"=================================\n"
136 TDBGOUT
"= strfmt @str_tmpl."
140 dbgoutd
"=================================\n"
141 TDBGOUT
"= in the upper example, uniq.shlib is existing in \$PWD/uniq.shlib,"
142 TDBGOUT
"= so include example.shlib with ${IMPB}uniq.shlib does not report errors${IMPE}."
144 dbgoutd
"=================================\n"
145 dbgoutd
"= ${HDRB}end of include path testing.${HDRE}\n"
146 dbgoutd
"=================================\n"